import cv2
import matplotlib.pyplot as plt
image=cv2.imread("lake.jpg")
cv2.imshow("Input",image)
gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
eqHist=cv2.equalizeHist(gray)
cv2.imshow("equalizeHist",eqHist)
plt.figure(figsize=(10,10))
hist1=cv2.calcHist([image],[0],None,[256],[0,255])
plt.subplot(121)
plt.title("Input")
plt.plot(hist1)
hist2=cv2.calcHist([eqHist],[0],None,[256],[0,255])
plt.subplot(122)
plt.title("equalizeHist")
plt.plot(hist2)
plt.show()
cv2.waitKey()
cv2.destroyAllWindows()